#include "vdsdevice.h"
#include "vdsdevice_p.h"

VdsDevice::VdsDevice() : d(new VdsDevicePrivate)
{
}

VdsDevice::~VdsDevice()
{
    d->close();
    delete d;
}

bool VdsDevice::open()
{
#ifdef WIN32
    return d->open("0x5345::0x1235");
#else
    return d->open("/dev/vds");
#endif
}

bool VdsDevice::close()
{
    return d->close();
}

int VdsDevice::read(unsigned char * data, size_t length)
{
    return d->read(data, length);
}

bool VdsDevice::write(const char * data, size_t length)
{
    return d->write(data, length);
}

long VdsDevice::errorCode() const
{
#ifdef WIN32
    return d->errorCode();
#else
    return errno;
#endif
}
